package com.luming.ethtran.controller;

import com.luming.ethtran.domain.Result;
import com.luming.ethtran.domain.SysUser;
import com.luming.ethtran.service.ISysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Luming
 * @Date 2024/9/2 13:52
 * @Description:
 */
@RestController
@RequestMapping("/sys")
@CrossOrigin(origins = "http://localhost:5173") // 允许跨域的前端地址
public class SysLoginController {
    
    @Autowired
    private ISysLoginService iSysLoginService;
    
    @PostMapping("/login")
    public Result login(@RequestBody SysUser sysUser) {
        return iSysLoginService.login(sysUser);
    }
    
    @PostMapping("/register")
    public Result register(@RequestBody SysUser sysUser) {
        return iSysLoginService.register(sysUser);
    }
}
